#include "gtkdebug.h"
#include "gtkeditable.h"
#include "gtklabelprivate.h"
-#include "gtktextprivate.h"
+#include "gtkentryprivate.h"
+#include "gtksearchentryprivate.h"
+#include "gtkpasswordentryprivate.h"
+#include "gtkspinbuttonprivate.h"
#include "gtktextview.h"
#include <gio/gio.h>
static void
-text_handle_method (GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
+entry_handle_method (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
{
GtkATContext *self = user_data;
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
GtkWidget *widget = GTK_WIDGET (accessible);
+ GtkText *text_widget;
+
+ if (GTK_IS_ENTRY (widget))
+ text_widget = gtk_entry_get_text_widget (GTK_ENTRY (widget));
+ else if (GTK_IS_SEARCH_ENTRY (widget))
+ text_widget = gtk_search_entry_get_text_widget (GTK_SEARCH_ENTRY (widget));
+ else if (GTK_IS_PASSWORD_ENTRY (widget))
+ text_widget = gtk_password_entry_get_text_widget (GTK_PASSWORD_ENTRY (widget));
+ else if (GTK_IS_SPIN_BUTTON (widget))
+ text_widget = gtk_spin_button_get_text_widget (GTK_SPIN_BUTTON (widget));
if (g_strcmp0 (method_name, "GetCaretOffset") == 0)
{
}
else if (g_strcmp0 (method_name, "GetTextBeforeOffset") == 0)
{
- PangoLayout *layout = gtk_text_get_layout (GTK_TEXT (widget));
+ PangoLayout *layout = gtk_text_get_layout (text_widget);
int offset;
AtspiTextBoundaryType boundary_type;
char *string;
}
else if (g_strcmp0 (method_name, "GetTextAtOffset") == 0)
{
- PangoLayout *layout = gtk_text_get_layout (GTK_TEXT (widget));
+ PangoLayout *layout = gtk_text_get_layout (text_widget);
int offset;
AtspiTextBoundaryType boundary_type;
char *string;
}
else if (g_strcmp0 (method_name, "GetTextAfterOffset") == 0)
{
- PangoLayout *layout = gtk_text_get_layout (GTK_TEXT (widget));
+ PangoLayout *layout = gtk_text_get_layout (text_widget);
int offset;
AtspiTextBoundaryType boundary_type;
char *string;
}
else if (g_strcmp0 (method_name, "GetStringAtOffset") == 0)
{
- PangoLayout *layout = gtk_text_get_layout (GTK_TEXT (widget));
+ PangoLayout *layout = gtk_text_get_layout (text_widget);
int offset;
AtspiTextGranularity granularity;
char *string;
}
else if (g_strcmp0 (method_name, "GetAttributes") == 0)
{
- PangoLayout *layout = gtk_text_get_layout (GTK_TEXT (widget));
+ PangoLayout *layout = gtk_text_get_layout (text_widget);
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
int offset;
int start, end;
}
else if (g_strcmp0 (method_name, "GetAttributeValue") == 0)
{
- PangoLayout *layout = gtk_text_get_layout (GTK_TEXT (widget));
+ PangoLayout *layout = gtk_text_get_layout (text_widget);
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
int offset;
const char *name;
}
else if (g_strcmp0 (method_name, "GetAttributeRun") == 0)
{
- PangoLayout *layout = gtk_text_get_layout (GTK_TEXT (widget));
+ PangoLayout *layout = gtk_text_get_layout (text_widget);
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
int offset;
gboolean include_defaults;
else if (g_strcmp0 (method_name, "GetDefaultAttributes") == 0 ||
g_strcmp0 (method_name, "GetDefaultAttributeSet") == 0)
{
- PangoLayout *layout = gtk_text_get_layout (GTK_TEXT (widget));
+ PangoLayout *layout = gtk_text_get_layout (text_widget);
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
gtk_pango_get_default_attributes (layout, &builder);
}
static GVariant *
-text_get_property (GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *property_name,
- GError **error,
- gpointer user_data)
+entry_get_property (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *property_name,
+ GError **error,
+ gpointer user_data)
{
GtkATContext *self = user_data;
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
return NULL;
}
-static const GDBusInterfaceVTable text_vtable = {
- text_handle_method,
- text_get_property,
+static const GDBusInterfaceVTable entry_vtable = {
+ entry_handle_method,
+ entry_get_property,
NULL,
};
{
if (GTK_IS_LABEL (widget))
return &label_vtable;
- else if (GTK_IS_TEXT (widget))
- return &text_vtable;
+ else if (GTK_IS_ENTRY (widget) ||
+ GTK_IS_SEARCH_ENTRY (widget) ||
+ GTK_IS_PASSWORD_ENTRY (widget) ||
+ GTK_IS_SPIN_BUTTON (widget))
+ return &entry_vtable;
else if (GTK_IS_TEXT_VIEW (widget))
return &text_view_vtable;